<?php
@require_once("config.php");
$user_id=$_GET["user_id"];
$user_name=$_GET["user_name"];
$user_phone=$_GET["user_phone"];
$user_address=$_GET["user_address"];
$sql="select * from useraddress where user_id='$user_id' and user_name='$user_name' and user_phone='$user_phone' and user_address='$user_address'";
$result=mysql_query($sql);
if(mysql_fetch_assoc($result)>0){
    $sql1="update useraddress set user_id=$user_id,user_name=$user_name,user_phone=$user_phone,user_address=$user_address where id='$id'";
}
else{
    $sql1="insert into useraddress(user_id,user_name,user_phone,user_address) value('$user_id','$user_name','$user_phone','$user_address')";
}
mysql_query($sql1);
$arr=array();
if(mysql_affected_rows()>0){
$arr["status"]=true;
$arr["msg"]="添加成功";
}else{
$arr["status"]=false;
$arr["msg"]="添加失败";
}
echo json_encode($arr);
?>